home *** CD-ROM | disk | FTP | other *** search
/ Varios Español / Varios Español.iso / PMAKER65 / archive.z / DIVIDIR ARTICULO.SPT < prev    next >
Text File  |  1997-01-14  |  3KB  |  141 lines

  1. -- Split Story
  2. -- 10 November 96, vsamarsk
  3.  
  4.  
  5. -- Este gui≤n destruye el enlace entre dos 
  6. -- bloques de texto.  Debe seleccionar los dos  
  7. -- bloques de texto antes de ejecutar el gui≤n.
  8.  
  9. -- (Precauci≤n: Si los bloques de texto contienen orφgenes de 
  10. -- hiperenlaces o anclas, puede que este gui≤n los traslade 
  11. -- a un lugar inesperado.)
  12.  
  13. getpagenumber => pn0
  14. getselectidlist => N,id1,...,...,...,t1,....,....,....,....,...,...,...,...,...,...,id2,...,...,...,t2,...
  15.  
  16.  
  17. if not(t1,t2=1,1)
  18.     message "Estado invßlido para gui≤n solicitado."
  19.     return
  20. endif
  21. selectid id1
  22. textedit
  23. gettextcursor => ...,c1,...
  24. deselect
  25. selectid id2
  26. textedit
  27. gettextcursor => ...,c2,...
  28. deselect
  29.  
  30. if c2<c1
  31.     set id1,id2=>id2,id1
  32. endif
  33.  
  34. rem check that 2 consequtive textblocks are selected
  35. selectid id1
  36. textedit
  37. textcursor +textblock
  38. textcursor +char
  39. gettextlocation => L,...
  40. if not(L=id2)
  41.     message "Estado no vßlido."
  42.     return
  43. endif
  44.  
  45. selectid id2
  46. textedit
  47. gettextcursor =>storyId,begin,...
  48. selectall
  49. gettextcursor => ...,...,end
  50. settextcursor -2,begin,end
  51. copy
  52. settextcursor -2,begin,begin
  53. gettextlocation => sourceId,...
  54. deselect;selectid sourceId
  55. gettransform => x
  56. getobjectloc lefttop => xLT,yLT
  57. getobjectloc righttop => xRT,yRT
  58. getobjectloc rightbottom => xRB,yRB
  59. getobjectloc leftbottom => xLB,yLB
  60. newstorysized min(xLT,xRT,xRB,xLB),min(yLT,yRT,yRB,yLB),max(xLT,xRT,xRB,xLB),max(yLT,yRT,yRB,yLB)
  61. paste
  62. textcursor -story
  63. gettextlocation => destId,...
  64. deselect;selectid destId
  65. gosub settrans.f,x
  66. getpagenumber => pn
  67. set destId => destId.sav
  68.  
  69. repeat
  70.     selectid sourceId
  71.     textedit
  72.     textcursor +textblock
  73.     textcursor +char
  74.     gettextcursor => tc
  75.     if not(tc(3)=end)
  76.         try settextcursor tc
  77.     endif
  78.     try gettextlocation=>sourceId.next,...
  79.     if (sourceId.next=sourceId)+empty(sourceId.next)
  80.         break
  81.     endif
  82.     set sourceId.next=>sourceId
  83.     selectid sourceId
  84.     gettransform => x
  85.     getobjectloc lefttop => xLT,yLT
  86.     getobjectloc righttop => xRT,yRT
  87.     getobjectloc rightbottom => xRB,yRB
  88.     getobjectloc leftbottom => xLB,yLB
  89.     getpagenumber => pn.next
  90.     page pn
  91.     selectid destId
  92.     try placenext bottom
  93.     getlasterror => err
  94.     if err
  95.         break
  96.     endif
  97.     rem now as textgun loaded return on the page where textblock should be placed
  98.     page pn.next
  99.     rem place new text to the bounding box of the old textblock
  100.     rem to be sure that it wont fall of pasteboard
  101.     placesized min(xLT,xRT,xRB,xLB),min(yLT,yRT,yRB,yLB),max(xLT,xRT,xRB,xLB),max(yLT,yRT,yRB,yLB)
  102.     rem now refine it
  103.     gosub settrans.f,x
  104.     
  105.     getselectidlist => ...,destId,...
  106.     set pn.next => pn
  107. until 0
  108.  
  109. settextcursor storyId,begin,end
  110. clear
  111. deselect
  112. selectid id1
  113. selectidextend destId.sav
  114. return
  115.  
  116. ///////////////
  117. sub settrans.f
  118. getprocparam => ...,transform
  119. getpagerect => page.lefttop.x, page.lefttop.y, page.rightbottom.x, page.rightbottom.y
  120. set (page.lefttop.x+page.rightbottom.x)/2,(page.lefttop.y+page.rightbottom.y)/2=>page.center.x,page.center.y
  121. set transform => rot,skew,refl,xlt,ylt,xrb,yrb,xLT,yLT,xRT,yRT,xRB,yRB,xLB,yLB
  122. set (xlt+xrb)/2=>xc
  123. set (ylt+yrb)/2=>yc
  124. set xlt-xc,ylt-yc,xrb-xc,yrb-yc=>xlt,ylt,xrb,yrb
  125. gettransform => ...,...,r,...
  126. rotate center,0
  127. skew center,0
  128. if r
  129.     reflect center,vertical
  130. endif
  131. move lefttop,xlt+page.center.x,ylt+page.center.y
  132. resize rightbottom,xrb+page.center.x,yrb+page.center.y
  133. if refl
  134.     reflect center,vertical
  135. endif
  136. rotate center,rot
  137. skew center,skew
  138. move lefttop,xLT,yLT
  139. resize rightbottom,xRB,yRB
  140. endsub
  141.